<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> 
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>

<![endif]-->
<link rel="stylesheet" type="text/css" href="<%=path %>/static/managecss/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/managecss/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/managecss/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/managecss/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>添加产品分类</title>
</head>
<body>
<div class="page-container">
	<form action="<%=path %>/manager/secondtype/secondtypeUpdateOne" method="post" class="form form-horizontal" id="form-user-add" enctype="multipart/form-data">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span>
				分类名称：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<input type="text" class="input-text" value="${requestScope.map.secondtype.title }" placeholder="" id="user-name" name="name">
			</div>
		</div>
		 <input type="hidden" name="id" id="secondtypeId" value="${requestScope.map.secondtype.id }">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>一级分类：</label>
			<div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
				<select name="firsttypeId" class="select" id="firsttype">
					<c:forEach items="${requestScope.map.firsttypes}" var="firsttype" varStatus="stat">
					<option value="${firsttype.id }" <c:if test="${ requestScope.map.secondtype.firsttype.id==firsttype.id}"> selected</c:if>>${firsttype.title}</option>
					</c:forEach>
				</select>
				</span> </div>
        </div>
        <div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">缩略图：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div class="uploader-thum-container">
					<div id="fileList" class="uploader-list"></div>
					<div id="filePicker"><input class="form-label col-xs-4 col-sm-2" type="file" id="inputs" name="file" multiple="multiple"/></div>
					<br><div id='list'>
			<ul id="list1" >
				
			</ul>
		</div><br>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">备注：</label>
			<div class="formControls col-xs-6 col-sm-6">
				<textarea name="content"  cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" onKeyUp="$.Huitextarealength(this,100)">${ requestScope.map.secondtype.content}</textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-2">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=path%>/static/managecss/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=path%>/static/managecss/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="<%=path%>/static/managecss/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="<%=path%>/static/managecss/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/jquery-3.2.1.js"></script>
<script type="text/javascript">
function reads(fil){
	var reader = new FileReader();
	reader.readAsDataURL(fil);
	reader.onload = function(){
		$('#list1').append("<li style='float:left' id='li'><img id='imgs' src='"+reader.result+"'></li>");
		
	};
}
$(document).ready(function () {
	
	$("#inputs").change(function () {
		$("li").remove();
		var fil = this.files;
		for (var i = 0; i < fil.length; i++) {
			var point = fil[i].name.lastIndexOf(".");	//文件名"."的下标
			var ext = fil[i].name.substr(point+1);		//文件后缀名
			if(ext=="bmp"||ext=="jpg"||ext=="png"||ext=="gif"){
				reads(fil[i]);
			}else{
				alert("第"+(i+1)+"张图片格式错误");
				return;
			}
			
		}
		isPic = true;
		$("#fileCount").val(fil.length);
		var line = parseInt((fil.length-0.5)/4);
		var divHeight = (line+1)*150+"px";
		$("#list").css("height",divHeight);
	});
});
$(function(){
	
});
</script>
</body>
</html>